#ifndef MYTCPSERVER_H
#define MYTCPSERVER_H


#include <QTcpServer>
#include <QList>

#include "mytcpsocket.h"

#include <QDebug>
#define qcout qDebug()<<"---------["<<__FILE__ <<":"<< __LINE__<<"]-->"


class MyTcpServer : public QTcpServer
{
    Q_OBJECT
public:
    MyTcpServer();

    //单例模式获取MyTcpServer
    static MyTcpServer &getInstance();

    //有新连接的时候处理
    void incomingConnection(qintptr handle) override;

    //获取这个tcpsocket链表
    QList<MyTcpSocket*>& get_m_tcpSocketList();

public slots:
    //关联MyTcpSocket传递来的offline信号
    void deleteSocket(MyTcpSocket* mysocket);


private:
    //保存所有的客户端socket
    QList<MyTcpSocket*> m_tcpSocketList;
};

#endif // MYTCPSERVER_H
